package cn.shop.cloud.web.config;

import cn.shop.cloud.resolver.UserMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @program: work
 * @ClassName WebConfig
 * @description:
 * @author: 李尧坤
 * @create: 2025−01-09 17:04
 * @Version 1.0
 **/

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private UserMethodArgumentResolver userMethodArgumentResolver;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        //将咱们自己定义的参数解析器 添加到 SpringMVC系统中
        resolvers.add(userMethodArgumentResolver);

    }

    @Bean
    public UserMethodArgumentResolver userMethodArgumentResolver(){

        return  new UserMethodArgumentResolver();
    }

}
